//
//  EvaluationImageViewModel.swift
//  AirTravel
//
//  Created by apple on 2021/7/21.
//

import UIKit

protocol EvaluationDelegate:NSObjectProtocol {
    func evaluationClick(data:NSDictionary)
}

class EvaluationImageViewModel: NSObject {

    weak var delegate: EvaluationDelegate?
    var collView : UICollectionView?
    let identifyHB = "HomeBannerColl"
    
    func bindViewToViewModel(collView : UICollectionView) {
        self.collView = collView
        self.collView?.dataSource = self
        self.collView?.delegate = self
        let layout = UICollectionViewFlowLayout.init()
        layout.scrollDirection = .vertical
        layout.itemSize = .init(width: (SCREEN_WIDTH - 42) / 3, height: (SCREEN_WIDTH - 42) / 3)
        layout.minimumInteritemSpacing = 6
        layout.minimumLineSpacing = 6
        layout.sectionInset = UIEdgeInsets.init(top: 6, left: 15, bottom: 6, right: 15)
        self.collView?.collectionViewLayout = layout
        
        self.collView?.isScrollEnabled = false
        
        self.collView?.showsVerticalScrollIndicator = true
        
        self.collView?.register(UINib.init(nibName: "HomeBannerColl", bundle: nil), forCellWithReuseIdentifier: identifyHB)
    }
}

extension EvaluationImageViewModel:UICollectionViewDataSource,UICollectionViewDelegate{
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return 4
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifyHB, for: indexPath) as! HomeBannerColl
        cell.img.image = UIImage.init(named: "图层59-2")
        return cell
    }
    
    
}
